test: Fix intermittent issues in feature_assumevalid.py#120
Draft
test: Fix intermittent issues in feature_assumevalid.py#120
Conversation
Replace `send_blocks_until_disconnected` with explicit block sends up to the invalid block, followed by `wait_for_disconnect()`. This removes a race where Python can outpace validation and advance the test before the disconnect happens.
Replace inline comments with `self.log.info()` messages for each scenario.
Move p2p setup and other non-log-producing preparation outside `assert_debug_log` blocks. This keeps each assertion focused on the log-producing actions.
For node0, node1, and node2, check the block-1 assumevalid log in a dedicated scope, then check later logs in a second scope to make assertions more precise and failure output shorter.
Replace polling-based waits with explicit synchronization and direct asserts. Use `send_and_ping` for non-disconnect paths, add the missing node2 invalid chaintip assertion, and simplify node1 height checking.
l0rinc
commented
Feb 19, 2026
| # signature so we can pass in the block hash as assumevalid. | ||
| self.start_node(0) | ||
|
|
||
| def send_blocks_until_disconnected(self, p2p_conn): |
l0rinc
commented
Feb 19, 2026
| for i in range(len(self.blocks)): | ||
| if not p2p_conn.is_connected: | ||
| break | ||
| try: |
| except IOError: | ||
| assert not p2p_conn.is_connected | ||
| break | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WIP, split bitcoin#34571